/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dtn.wsn.dao;

import com.dtn.wsn.database.ConnectionPool;
import com.dtn.wsn.entity.Gateway;


import java.sql.SQLException;

import java.sql.Connection;   
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Data Access object for Gateway Entity
 * @author hao
 */
public class GatewayDAO {
    
    private ConnectionPool connectionPool;

    public GatewayDAO(ConnectionPool connectionPool) {
        this.connectionPool = connectionPool;
    }
    
    /**
     * insert gateway into database
     * @param gw
     * @return 
     */
    public int insertGateway(Gateway gw)
    {
        if(gw != null){
            String strSql = "insert into gateway ";

            try {
                Connection cn = connectionPool.getConnection();
                Statement stmt = cn.createStatement();
                stmt.executeUpdate(strSql);
                connectionPool.freeConnection(cn);
            } catch (SQLException e) {
                System.out.println("insert student record error :" + e);
            }
        }
        return 0;
    }
    /**
     * delete gateway information
     * @param gw
     * @return 
     */
    public int deleteGateway(Gateway gw)
    {
    
        return 0;
    }
    
    
    
}
